
/**
 * KoaMqRouter
 */
class KoaMqRouter {
    constructor() {
        this.routeList = {};
    }

    use(name, opts, gen) {
        this.routeList[name] = { opts, gen };
        return this;
    }

    merge(prefix, routes) {
        for (const key of Object.keys(routes)) {
            const val = routes[key];
            this.use(`${prefix}:${key}`, val.opts, val.gen);
        }
        return this;
    }

    routes() {
        return this.routeList;
    }
}

export default KoaMqRouter;
